home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9254 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  4.4 KB

  1. Path: watnews.watson.ibm.com!ncohen
  2. From: ncohen@watson.ibm.com (Norman H. Cohen)
  3. Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++
  4. Subject: Re: C/C++ knocks the crap out of Ada
  5. Date: 29 Feb 1996 16:09:05 GMT
  6. Organization: IBM T.J. Watson Research Center
  7. Distribution: world
  8. Message-ID: <4h4j31$1ga3@watnews1.watson.ibm.com>
  9. References: <JSA.96Feb16135027@organon.com> <4gaa6l$8mk@post.gsfc.nasa.gov> <4gd94r$isu@mack.rt66.com> <1996Feb22.005518.13396@leeweyr.sccsi.com> <4gvrffINNlqo@anvil.ugrad.cs.ubc.ca>
  10. Reply-To: ncohen@watson.ibm.com
  11. NNTP-Posting-Host: rios8.watson.ibm.com
  12.  
  13. In article <4gvrffINNlqo@anvil.ugrad.cs.ubc.ca>, c2a192@ugrad.cs.ubc.ca
  14. (Kazimir Kylheku) writes: 
  15.  
  16. |> What is intrinsically unsafe about C?
  17.  
  18. The pitfalls that allow small typographical errors to result in programs
  19. that compile successfully but behave in a way far different from what was
  20. intended.  (See Koenig's book, for example.)
  21.  
  22. The lack of sufficient information in a program to perform meaningful
  23. consistency checks.
  24.  
  25. The lack of a clear division between the portable and target-specific
  26. features of the language.
  27.  
  28. etc.
  29.  
  30. |>                                       I could write a strict,
  31. |> standard-conforming, anally-retentive program in any language that could kill
  32. |> people (maliciously, of course).
  33.  
  34. But it's easier to do it ACCIDENTALLY in C.
  35.  
  36. |> Software which has life-threatening consequences shoud not be left to something
  37. |> that sacrifices intimacy with hardware for some higher purpose that has more to
  38. |> do with bureaucracy than anything else.
  39.  
  40. I don't understand this conflict between "intimacy with the hardware" and
  41. "bureaucracy" or how it relates to programming languages.  Indeed, the
  42. bureaucratic measures wisely imposed on the validation of safety-critical
  43. software require that the generated machine code be validated along with
  44. the source code.  Perhaps Kazimir Kylheku could explain the conflict he
  45. perceives.
  46.  
  47. |> And it should certainly not be written in some poorly standardized language,
  48. |> for which no two implementations are in agreement. C is governed by an
  49. |> ISO standard, which, if adhered to, lets a strictly conforming program
  50. |> translated by a strictly conforming implementation yield well-defined results.
  51. |>
  52. |> I don't think you can say the same for Ada or C++.
  53.  
  54. Ada became an ANSI standard in 1983 and an ISO standard in 1987.  A
  55. revised standard was approved by ISO in 1995.
  56.  
  57. When someone mentions a language "for which no two implementations are in
  58. agreement", it is C that springs to mind.  Much of the Harbison-Steele
  59. book is devoted to explaining the distinctions among K&R C, "traditional"
  60. C (which includes extensions made after 1978), and ANSI C.  They describe
  61. the Bell Labs Portable C Compiler as "a de facto standard for the
  62. traditional language." I have heard many C programmers express the
  63. opinion that portability of C programs is best insured by writing in K&R
  64. C rather than in ANSI C!  And then on top of this, we have post-ANSI
  65. dialects such as GNU C and Microsoft C foisted upon us by those who feel
  66. they are in a position to impose their own de facto standards.  For
  67. example, in the description of the -pedantic option in section 2.3 of
  68. "Using GNU CC," Stallman writes: 
  69.  
  70.     A feature to report any failure to conform to ANSI C might be useful
  71.     in some instances, but would require considerable additional work and
  72.     would be quite different from '-pedantic'.  We recommend, rather,
  73.     that users take advantage of the extensions of GNU C and disregard
  74.     the limitations of other compilers.  Aside from certain
  75.     supercomputers and obsolete small machines, thre is less and less
  76.     reason ever to use any other C compiler other than for bootstrapping
  77.     GNU CC.
  78.  
  79. The culture in the Ada community is quite different.  The need to pass a
  80. rigorous validation suite to be approved for use on U.S. Department of
  81. Defense projects, and the requirement in the standard itself to reject
  82. certain forms of nonconformance at compile time, have led compiler
  83. writers to implement the standard strictly and consistently.
  84. To the extent that Ada compiler writers have sensed the need for
  85. extensions, these extensions have been in the form of "changeable parts"
  86. anticipated by the standard--implementation-defined attributes, pragmas,
  87. and packages.  Many of these implementation variations--for exmaple,
  88. vendor-specific packages for command-line argument retrieval--have now
  89. been replaced by standard versions in Ada 95.
  90.  
  91. --
  92. Norman H. Cohen    ncohen@watson.ibm.com
  93.